package org.zhadoop.stream.cql.semanticanalyzer.analyzecontext;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.zhadoop.stream.api.streams.Schema;
import org.zhadoop.stream.cql.exception.SemanticAnalyzerException;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.ParseContext;

import com.google.common.collect.Lists;

/**
 * 创建新流语义分析内容
 * @author zwd
 *
 */
public class CreateStreamAnalyzeContext extends AnalyzeContext{
	
	private Schema schema;
	
	private String streamName;
	
	private String streamAlias;
	
	private String deserializerClassName;
	
	private String serializerClassName;
	
	private String recordReaderClassName;
	
	private String recordWriterClassName;
	
	private Integer parallelNumber;
	
	private Map<String, String> serDeProperties = new HashMap<String,String>();
	
	private Map<String,String> readWriterProperties = new HashMap<String,String>();
	
	private ParseContext parseContext = null;
	
	
	

	@Override
	public void setParseContext(ParseContext parseContext) {
		this.parseContext = parseContext;
	}

	@Override
	public void validateParseContext() throws SemanticAnalyzerException {
		
	}

	@Override
	public List<Schema> getCreatedSchemas() {
		return Lists.newArrayList(schema);
	}

	@Override
	public String toString() {
		if (parseContext == null)
        {
            return "";
        }
        return parseContext.toString();
	}
	
	
	

	public Schema getSchema() {
		return schema;
	}

	public void setSchema(Schema schema) {
		this.schema = schema;
	}

	public String getStreamName() {
		return streamName;
	}

	public void setStreamName(String streamName) {
		this.streamName = streamName;
	}

	public String getStreamAlias() {
		return streamAlias;
	}

	public void setStreamAlias(String streamAlias) {
		this.streamAlias = streamAlias;
	}

	public String getDeserializerClassName() {
		return deserializerClassName;
	}

	public void setDeserializerClassName(String deserializerClassName) {
		this.deserializerClassName = deserializerClassName;
	}

	public String getSerializerClassName() {
		return serializerClassName;
	}

	public void setSerializerClassName(String serializerClassName) {
		this.serializerClassName = serializerClassName;
	}

	public String getRecordReaderClassName() {
		return recordReaderClassName;
	}

	public void setRecordReaderClassName(String recordReaderClassName) {
		this.recordReaderClassName = recordReaderClassName;
	}

	public String getRecordWriterClassName() {
		return recordWriterClassName;
	}

	public void setRecordWriterClassName(String recordWriterClassName) {
		this.recordWriterClassName = recordWriterClassName;
	}

	public Integer getParallelNumber() {
		return parallelNumber;
	}

	public void setParallelNumber(Integer parallelNumber) {
		this.parallelNumber = parallelNumber;
	}

	public Map<String, String> getSerDeProperties() {
		return serDeProperties;
	}

	public void setSerDeProperties(Map<String, String> serDeProperties) {
		this.serDeProperties = serDeProperties;
	}

	public Map<String, String> getReadWriterProperties() {
		return readWriterProperties;
	}

	public void setReadWriterProperties(Map<String, String> readWriterProperties) {
		this.readWriterProperties = readWriterProperties;
	}

	public ParseContext getParseContext() {
		return parseContext;
	}
}